<template>
  <div id="app">
    <router-view />
  </div>
</template>

<script>
import { mapGetters, mapState } from 'vuex';
export default {
  name: 'app',
  data() {
    return {
      socket: null
    };
  },
  watch: {},
  created() {
    //打开socket链接1
    //this.$store.dispatch('setSocketConnection', this.userInfo)
  },
  computed: {
    ...mapGetters(['tenantId','isWarterMark','userInfo','socketConnection']),
  },
  methods: {
    /**
     * 设置水印
     */
    setWarterMark(){
      if(this.userInfo.companyName && this.userInfo.realName){
        if(this.isWarterMark){
          this.isWarterMark.remove();
        }
        let obj = this.watermark({
          text: this.userInfo.companyName+'-'+this.userInfo.realName,
          textStyle: 'rgba(65,105,225,0.10)',
          degree: '-30',
          font: '20px 微软雅黑'
        })
        this.$store.commit('IS_WARTER_MARK',obj);
      }
    },
  },
  mounted() {
    this.setWarterMark();
  },
  watch:{
    userInfo: {
      handler(newValue, oldValue) {
        this.setWarterMark();
      },
      deep: true
    }
  }
};
</script>
<style lang="scss">
@import './index.scss';
</style>
